<template>
	<view>
	    +{{ remainingCount }}
	  </view>
</template>

<script>
	export default{
		props:{
			list:{
				type:Array,
				default:true
			},
			index:{
				type:Number,
				default:true
			}
		},
		computed: {
			remainingCount() {
				// 确保 list 存在且有至少一个元素
				if (this.list && this.list.length > 0) {
					// 确保 imageName 属性存在并且是一个数组
					const imageNames = this.list;
					if (Array.isArray(imageNames)) {
						const totalImages = imageNames.length;
						console.log("计算剩余图片数量", totalImages);
						const remainingImages = totalImages - 8;
						// 确保不返回负数
						return Math.max(remainingImages, 0);
					}
				}
		
				// 如果 list 为空或 imageName 不可用，返回 0
				return 0;
			}
		},
	}
</script>

<style scoped lang="scss">
	/* .ImgCount {
		position: absolute;
		width: 204rpx;
		height: 204rpx;
		margin: 0;
		top: 0;
		left: 0;
		right: 0;
		background: #313030;
		opacity: 0.7;
		display: flex;
		align-items: center;
		justify-content: center;
		color: #fff;
		border-radius: 15rpx;
	} */
</style>